/**
 * @Author: wangjian
 * 656876071@qq.com
 * @Date: 2024年8月8日 15:33:50
 * @LastEditTime: 2024-09-20 11:15:21
 * @FilePath: src/views/sys/api/SysUserRoleApi.ts
 * @Description:
 */
import r from '@/core/utils/request'

export interface SysUserRole {
         id? : string;
         userId? : string;
         roleId? : string;
         roleIds? : string[];

    [key:string]:any
}

export default () => {
    return {
        getPage: ({params: queryParams = {}, current = 1, size = 10}) => {
            return r.get('sys/user/role/page', {
                params: {
                    current,
                    size,
                    ...queryParams
                }
            })
        }
        ,
        getById: (id: string) => {
            return r.get(`sys/user/role/${id}`)
        },
        add:
            (rawObject: SysUserRole) => {
                return r.post('sys/user/role', rawObject)
            },
        update:
            (rawObject: SysUserRole) => {
                return r.put(`sys/user/role`, rawObject)
            }
            ,
        deleteById:
            (id: string) => {
                return r.delete(`sys/user/role/${id}`)
            },
        //get-user-role-ids/{userId}
        getUserRoleIds: (userId: string) => {
            return r.get(`sys/user/role/get-user-role-ids/${userId}`)
        },
        //@PutMapping("update-user-roles")
        updateUserRoles: (rawObject: SysUserRole) => {
            return r.put(`sys/user/role/update-user-roles`, rawObject)
        }
    }
}